package org.myspringframework.mvc.render;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.myspringframework.mvc.RequestProcessorChain;

import javax.servlet.http.HttpServletResponse;

/**
 * org.myspringframework.mvc.render <br>
 * 内部异常处理器
 *
 * @author jaymin
 * @since 2021/5/22
 */
@AllArgsConstructor
@NoArgsConstructor
public class InternalErrorResultRender implements ResultRender {
    /**
     * 错误信息
     */
    private String errorMessage;

    @Override
    public void render(RequestProcessorChain requestProcessorChain) throws Exception {
        HttpServletResponse httpServletResponse = requestProcessorChain.getHttpServletResponse();
        httpServletResponse.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, errorMessage);
    }
}
